package com.zc.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zc.dao.IPresDao;
import com.zc.domain.Item;
import com.zc.domain.TwoPointsItem;
import com.zc.service.PresService;

@Service(value="presService")
public class PresServiceImpl implements PresService{
	@Autowired
	private IPresDao presDao;
	
	@Override
	public List<Item> getSubPressure() {
		return presDao.getPressure("fzzyl");
	}
	@Override
	public List<Item> getMainPressure() {
		return presDao.getPressure("mzzyl");
	}
	@Override
	public List<TwoPointsItem> getPressure() {
		List<Item> subPressureData=presDao.getPressure("fzzyl");
		List<Item> mainPressureData=presDao.getPressure("mzzyl");		
		if(subPressureData.size()!=mainPressureData.size())
			return null;
		List<TwoPointsItem> pressureData=new ArrayList<TwoPointsItem>();		
		for(int i=0;i<subPressureData.size();i++)
			pressureData.add(new TwoPointsItem(mainPressureData.get(i).getData(), subPressureData.get(i).getData()));		
		return pressureData;
	}
}
